
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<div class="container">
				<simple-grid :data-list="gridData" :columns="gridColumns">
				</simple-grid>
			</div>
		</div>

		<template id="grid-template">
			<table>
				<thead>
					<tr>
						<th v-for="col in columns">
							{{ col }}
						</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(index,entry) in dataList">
						<td v-for="col in columns">
							{{entry[col]}}
						</td>
					</tr>
				</tbody>
			</table>
		</template>

		<script src="vue.js"></script>
		<script src="vue-resource.js"></script>
		<script>
			Vue.component('simple-grid', {
				template: '#grid-template',
				props: ['dataList', 'columns']
			})
		</script>
		<script>

			var demo = new Vue({
				el: '#app',
				data: {
					gridColumns: ['customerId', 'companyName', 'contactName', 'phone'],
					gridData: [],
					apiUrl: 'http://192.168.3.67/dc2/index.php/home/index/ajax_getdashi'
				},
				mounted: function() {
					this.$http.jsonp('http://192.168.3.67/dc2/index.php/home/index/ajax_getdashi',{
						params: {Ipage:2}},{
						emulateJSON: true
						}).then(function(response) {
						  // 这里是处理正确的回调
							console.log(response.data)
						}, function(response) {
							// 这里是处理错误的回调
							console.log(response)
						});
				}
			})

			/*这样的PHP接口返回才能正常接收
			php code:

			$call = I('callback');
			$json=json_encode($return);
			echo $call.'('.$json.')';

			*/
		</script>
	</body>

</html>
